import { defHttp } from "@/utils/http";

// ERP 计量单位 VO
export interface UnitMeasVO {
	id: number; // id	主键ID,示例值(16385)
	name: string; // 计量单位名称
	parentId: number; // 父级ID,示例值(32299)
	sqNumb: number; // 序号
}

// ERP 计量单位 API
export const UnitMeasApi = {
	// 查询计量单位分页
	getUnitMeasPage: async (params: any) => {
		return await defHttp.get({ url: `/whs/meas-unit/page`, params });
	},

	// 查询计量单位详情
	getUnitMeas: async (id: number) => {
		return await defHttp.get({ url: `/whs/meas-unit/get?id=` + id });
	},

	// 新增计量单位
	createUnitMeas: async (data: UnitMeasVO) => {
		return await defHttp.post({ url: `/whs/meas-unit/create`, data });
	},

	// 修改计量单位
	updateUnitMeas: async (data: UnitMeasVO) => {
		return await defHttp.put({ url: `/whs/meas-unit/update`, data });
	},

	// 删除计量单位
	deleteUnitMeas: async (id: number) => {
		return await defHttp.delete({ url: `/whs/meas-unit/delete?id=` + id });
	},

	// 导出计量单位 Excel
	exportUnitMeas: async (params: any) => {
		return await defHttp.download({ url: `/whs/meas-unit/export-excel`, params });
	}
};
